<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.vsg.stock.core.domain.mybatis.ExRightsProxy">


	<resultMap id="ExRightsResult" type="org.vsg.stock.core.domain.mybatis.ExRightsProxy">
		<id property="id.stockCode" column="STOCK_CODE" />
		<id property="id.registerDate" column="REGISTER_DATE" />
		<!-- 
		<result property="id.stockCode" column="STOCK_CODE"/>
		<result property="id.registerDate" column="REGISTER_DATE"/>
		 -->
		<result property="circulationDate" column="CIRCULATION_DATE"/>
		<result property="deductionDate" column="DEDUCTION_DATE"/>
		<result property="bonusDate" column="BONUS_DATE"/>
		<result property="remark" column="REMARK"/>
	</resultMap>


	<insert id="insertExRights" 
		parameterType="org.vsg.stock.core.domain.ExRights">
		insert into STOCK_EX_RIGHT 
			(STOCK_CODE , REGISTER_DATE , CIRCULATION_DATE, DEDUCTION_DATE, BONUS_DATE , REMARK)
		values 
			(#{id.stockCode} , #{id.registerDate}, #{circulationDate},#{deductionDate},#{bonusDate} , #{remark})
	</insert>


	<select id="findAllExrights"  resultMap="ExRightsResult">
    	select 
    	 STOCK_CODE , REGISTER_DATE , CIRCULATION_DATE, DEDUCTION_DATE, BONUS_DATE , REMARK
    		from STOCK_EX_RIGHT 
  	</select>	


	<select id="findExtRightsKey"  resultType="string">
    	select 
    		STOCK_CODE||'|'||REGISTER_DATE
    		from STOCK_EX_RIGHT 
  	</select>

</mapper>
